<extend name="Public:base" />
<block name="header_js">
<script type="text/javascript" src="__PUBLIC__/js/calendar.config.js"></script>
<script type="text/javascript" src="__DATA__/static/jq_plugins/iColorPicker/iColorPicker.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/XYHUploader/XYHUploader.js"></script>

<script type="text/javascript">
$(function () {
	//缩略图上传
	
	var ad_type = {$cate['type']};
	if ($('#litpic').length > 0) {

		$('#litpic').XYHUploader({
			sfile:"abc1", 
			furl:"{:U('Public/upload')}", 
			burl:"{:U('Public/browseFile', array('stype' => 'ad'))}",
			show: (ad_type == 2 ? true : false),
			thide: false,
			thumflag: false
		});

	}

	

});




</script>
	
</block>

<block name="content">
	<div class="row">
		<div class="col-lg-12">
			<h3 class="page-header"><em class="glyphicon glyphicon-cloud-upload"></em> 
			添加广告  
		    </h3>
		</div>
		
	</div>


	<div class="row">
		<div class="col-lg-12">

				<form method='post' class="form-horizontal" id="form_do" name="form_do" action="{:U('editDetail')}">											

					<div class="form-group">
						<label for="inputTtitle" class="col-sm-2 control-label">广告名称</label>
						<div class="col-sm-9">
							<input type="text" name="title" id="inputTtitle" value="{$vo.title}" class="form-control" placeholder="广告名称" required="required" />									
						</div>
					</div>
					<div class="form-group">
						<label for="start_time" class="col-sm-2 control-label">开始时间</label>
						<div class="col-sm-9">
							<input type="text" name="start_time" id="start_time" class="form-control" value="{$vo.start_time}">
			                <script type="text/javascript">
			                    Calendar.setup({
			                        weekNumbers: true,
			                        inputField : "start_time",
			                        trigger    : "start_time",
			                        dateFormat: "%Y-%m-%d %H:%M:%S",
			                        showTime: true,
			                        minuteStep: 1,
			                        onSelect   : function() {this.hide();}
			                    });
			                </script>									
						</div>
					</div>

					<div class="form-group">
						<label for="inputColor" class="col-sm-2 control-label">结束时间</label>
						<div class="col-sm-5">
							<input type="text" name="end_time" id="end_time" class="form-control" value="{$vo.end_time}">
			                <script type="text/javascript">
			                    Calendar.setup({
			                        weekNumbers: true,
			                        inputField : "end_time",
			                        trigger    : "end_time",
			                        dateFormat: "%Y-%m-%d %H:%M:%S",
			                        showTime: true,
			                        minuteStep: 1,
			                        onSelect   : function() {this.hide();}
			                    });
			                </script>									
						</div>
					</div>

					<switch name="cate['type']">
	   				<case value="1">
					<div class="form-group">
						<label for="inputContent" class="col-sm-2 control-label">文字内容</label>
						<div class="col-sm-9">
							<textarea name="content" id="inputContent" rows="5" class="form-control">{$vo.content}</textarea>								
						</div>
					</div>
					</case>
	    			<case value="2">
					<div class="form-group">
						<label for="litpic" class="col-sm-2 control-label">图片</label>
						<div class="col-sm-9">
							    <input type="text" class="form-control" name="content" value="{$vo.content}" id="litpic" placeholder="图片地址" />	
						</div>
					</div>
					</case>
	    			<case value="3">
					<div class="form-group">
						<label for="litpic" class="col-sm-2 control-label">flash</label>
						<div class="col-sm-9">
							    <input type="text" class="form-control" name="content" id="litpic" value="{$vo.content}" placeholder="flash地址" />	
						</div>
					</div>
					</case>
	    			</switch>

					<div class="form-group">
						<label for="inputUrl" class="col-sm-2 control-label">链接地址</label>
						<div class="col-sm-9">
							<input type="text" name="url" id="inputUrl" class="form-control" value="{$vo.url}"placeholder="链接地址" />						
						</div>
					</div>

					
					<div class="form-group">
						<label for="inputSort" class="col-sm-2 control-label">排列</label>
						<div class="col-sm-9">
							<input type="text" name="sort" id="inputSort" value="{$vo.sort}" class="form-control" placeholder="排列" />							
						</div>
					</div>

					<div class="form-group">
						<label for="inputName" class="col-sm-2 control-label">状态</label>
						<div class="col-sm-9">
							<label class="radio-inline">
							 	<input type="radio" name="status" value="1" <if condition="$vo['status'] eq 1">checked="checked"</if> />启用				
							 </label>
							<label class="radio-inline">
							 	<input type="radio" name="status" value="0" <if condition="$vo['status'] eq 0">checked="checked"</if> />停用		
							 </label>	
						</div>
					</div>		
					
					<div class="row margin-botton-large">
						<div class="col-sm-offset-2 col-sm-9">
							<input type="hidden" name="id" value="{$vo.id}" />
							<input type="hidden" name="aid" value="{$cate.id}" />
							<input type="hidden" name="type" value="{$cate.type}" />		
							<div class="btn-group">
								<button type="submit" class="btn btn-primary"> <i class="glyphicon glyphicon-saved"></i>
									保存
								</button>
								<button type="button" onclick="goUrl('{:U('detail', array('aid' => $cate['id']))}')" class="btn btn-default"> <i class="glyphicon glyphicon-chevron-left"></i>
									返回
								</button>
							</div>
						</div>
					</div>
				</form>
	
		</div>
	</div>

		


</block>